package win.smartown.app.weather.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by smartown on 2017/5/8 14:02.
 * Desc:位置数据
 */
public class Location implements Parcelable {

    private String id;
    private String country;
    private String province;
    private String city;
    private String district;
    private String latitude;
    private String longitude;
    private boolean locate;

    protected Location(Parcel in) {
        id = in.readString();
        country = in.readString();
        province = in.readString();
        city = in.readString();
        district = in.readString();
        latitude = in.readString();
        longitude = in.readString();
        locate = in.readByte() != 0;
    }

    public static final Creator<Location> CREATOR = new Creator<Location>() {
        @Override
        public Location createFromParcel(Parcel in) {
            return new Location(in);
        }

        @Override
        public Location[] newArray(int size) {
            return new Location[size];
        }
    };

    public Location(String district, String latitude, String longitude) {
        this.district = district;
        this.latitude = latitude;
        this.longitude = longitude;
    }

    public String getId() {
        return id;
    }

    public String getCountry() {
        return country;
    }

    public String getProvince() {
        return province;
    }

    public String getCity() {
        return city;
    }

    public String getDistrict() {
        return district;
    }

    public String getLatitude() {
        return latitude;
    }

    public String getLongitude() {
        return longitude;
    }

    public boolean isLocate() {
        return locate;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeString(country);
        dest.writeString(province);
        dest.writeString(city);
        dest.writeString(district);
        dest.writeString(latitude);
        dest.writeString(longitude);
        dest.writeByte((byte) (locate ? 1 : 0));
    }
}
